1. Field of the Invention
The present invention relates to operating systems, and more particularly, to processing isochronous data by general-purpose operating systems.
2. Description of the Related Art
Computer systems, such as personal computer systems, were originally developed for business applications such as word processing, databases and spreadsheets, among others. Computer systems, however, are currently being used to handle a number of isochronous tasks, including: multimedia applications having video and audio components, video capture and playback, telephony applications, and speech recognition and synthesis, among others. Generally speaking, isochronous tasks are time-dependent tasks. In other words, the data handled by an isochronous task must be delivered or processed within certain time constraints. Isochronous tasks typically require some degree of precision scheduling and execution.
One problem that has risen is that computer systems originally designed for business applications are not well-suited to the time-dependent requirements of modern multimedia applications. For example, modem personal computer system architectures still presume that the majority of applications executed on the computer system are business applications such as word processing and/or spreadsheet applications, which typically include non-time-dependent tasks. The computer systems typically implement general-purpose operating systems, which may efficiently schedule tasks, but which may not ensure the execution of a task at precise intervals as required for isochronous tasks. For example, a general-purpose operating system may not be able to guarantee the execution of a task within 100 milliseconds. This delay may be unacceptable for isochronous tasks such as audio, video and telephony. The delay may cause perceptible errors such as gaps or altered frequencies in audio signals, blank screens or lines in video signals, and echoes in telephony.
Traditionally, the central processing unit (CPU) of typical computer systems could not efficiently handle isochronous tasks, so isochronous tasks, such as a modem function, typically used dedicated hardware. It is desirable to modify CPUs to handle isochronous tasks so that the dedicated hardware used for isochronous tasks may be eliminated.
Some computer systems implement a real-time operating system (RTOS) to ensure precise execution of time-dependent tasks. Real-time operating systems typically include a clock which starts and stops tasks at regular intervals. The operating system may implement an interrupt which is asserted to start and stop tasks. The tasks typically include a specified rate of execution and a specified maximum duration. The operating system starts a task at the specified rate and expects the task to complete within the specified maximum duration so that a new task may be started. Unfortunately, real-time operating systems depend upon the tasks being well-behaved for correct operation. For example, if a task exceeds its specified maximum duration, the operating system may not be able to execute the next scheduled task. This situation may cause real-time operating systems to crash. In many computer systems, tasks may come from many different sources and it is difficult to guarantee that each task is well-behaved. Accordingly, real-time operating systems are not well-suited to common computing applications.
Several partially effective methods of providing real-time capability to general-purpose operating systems have been used. A general-purpose operating system is an example of a non-real-time operating system. Generally speaking, a non-real-time operating system is an operating system designed to support tasks that do not have well-defined execution durations. One method of providing real-time capability to a general-purpose operating system is to perform real-time tasks during an interrupt service routine. An interrupt causes an interrupt service routine to be executed and real-time work is done within the interrupt service routine. This method creates the problem that the code within the interrupt service routine is uninterruptable. Therefore, the operating system has no way to preempt or terminate a real-time task to initiate another task. Accordingly, if a real-time task exceeds a predetermined duration or gets locked-up, the operating system has no way to take control and may crash.
The Windows 98 operating system attempts to handle real-time and isochronous tasks by implementing a deferred procedure call. When an interrupt initiates a real-time task, the interrupt service routine is limited to gathering critical data, determining the source of the interrupt and requesting a deferred procedure call. The deferred procedure call is put in a FIFO queue. The deferred procedure calls in the FIFO queue are given highest priority by the operating system. Deferred procedure calls are preemptable so that higher priority task may be issued. Unfortunately, this method is not protected against mis-behaving software. For example, if a task initiated by a deferred procedure call disables interrupts, the operating system may not be able to preempt or terminate the task if necessary.
What is desired is a reliable way to execute isochronous tasks in a general-purpose operating system.
The present invention contemplates a computer system that includes a real-time interrupt. The real-time interrupt may cause an operating system to determine whether an isochronous task is pending. If an isochronous task is pending, the operating system executes the isochronous task. In one particular embodiment, the interrupt is derived from a master clock signal that also provides a clock signal to isochronous peripheral devices. In one embodiment, applications that include isochronous tasks are certified to be well-behaved. In one particular embodiment applications are registered with an operating system vendor. The operating system will only initiate an application is known to be well-behaved by checking a list of certified applications.
The operating system may not initiate an application if insufficient resources are available for executing the isochronous tasks of the application. Each isochronous task informs the operating system of an execution interval and a duration. Prior to initiating an application, the operating system verifies that sufficient resources are available to execute the isochronous tasks of the application. In one embodiment, the operating system includes a user interface. In one particular embodiment, if sufficient resources are not available to execute the isochronous tasks of an application, the operating system uses the system interface to query a user whether to suspend an existing application, to increase the percentage of operating system bandwidth allocated to isochronous tasks, or to not initiate the new application.
In one embodiment, the operating system includes a non-maskable interrupt to terminate isochronous tasks. Termination may be necessary if an isochronous task fails to completely execute within its specified duration.
In one embodiment, the operating system includes two types of time-slices. Higher priority tasks are allocated to quick slices and lower priority tasks are allocated to standard slices. Standard slices are preemptable and quick slices are not preemptable. In one embodiment, a standard slice that has been preempted may assert a flag indicating that the task has been preempted and may make the task non-preemptable the next time it is invoked.
Broadly speaking the present invention contemplates a processor, a memory coupled to the processor, interrupt generation circuitry coupled to the processor and configured to output a time-slice interrupt at a known rate, a system clock coupled to the interrupt generation circuitry, and a non-realtime operating system. The non-realtime operating system is configured to operate on the processor and to receive the time-slice interrupt. The operating system is configured to execute a pending isochronous task with a predetermined maximum execution time when the operating system receives the time-slice interrupt. Applications including isochronous tasks are certified to be well-behaved.
The present invention further contemplates a personal computer including: a processor, a main memory coupled the processor, a local bus coupled to the processor, one or more isochronous peripheral devices coupled to the local bus and configured to send or receive isochronous data, interrupt generation circuitry coupled to the processor and configured to output a time-slice interrupt at a known rate, a system clock coupled to the interrupt generation circuitry, and a non-realtime operating system. The non-realtime operating system is configured to operate on the processor and receive the time-slice interrupt. The operating system is configured to execute a pending isochronous task with a predetermined maximum execution time when the operating system receives the time-slice interrupt. Applications including isochronous tasks are certified to be well-behaved.
The present invention still further contemplates a method of reliably executing isochronous tasks in a non-realtime operating system comprising: certifying one or more applications including isochronous tasks to be well-behaved; receiving an interrupt; executing the pending isochronous task; and if no additional isochronous tasks are pending, executing a non-isochronous task.